package cn.donzell.web;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.apache.shiro.authz.annotation.RequiresPermissions;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import top.ibase4j.core.util.WebUtil;

import cn.donzell.model.AntOrder;
import cn.donzell.service.IAntOrderService;
import top.ibase4j.core.base.BaseController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 商品  前端控制器
 * </p>
 *
 * @author Donzell
 * @since 2019-02-13
 */
@RestController
@RequestMapping("/antOrder")
@Api(value = "商品接口", description = "商品接口")
public class AntOrderController extends BaseController<AntOrder, IAntOrderService> {
	@ApiOperation(value = "查询全部商品")
    @PostMapping(value = "/read/list")
	@RequiresPermissions("antOrder.read")
	public Object query(HttpServletRequest request) {
		Map<String, Object> param = WebUtil.getParameter(request);
		return super.queryList(param);
	}

	@ApiOperation(value = "分页查询商品")
    @PostMapping(value = "/read/page")
	@RequiresPermissions("antOrder.read")
	public Object queryPage(HttpServletRequest request) {
		Map<String, Object> param = WebUtil.getParameter(request);
		return super.query(param);
	}

	@ApiOperation(value = "商品详情")
    @PostMapping(value = "/read/detail")
	@RequiresPermissions("antOrder.read")
	public Object get(HttpServletRequest request) {
		AntOrder param = WebUtil.getParameter(request, AntOrder.class);
		return super.get(param);
	}

	@ApiOperation(value = "修改商品")
	@PostMapping(value = "/save")
	@RequiresPermissions("antOrder.update")
	public Object update(HttpServletRequest request) {
		AntOrder param = WebUtil.getParameter(request, AntOrder.class);
		return super.update(param);
	}

	@ApiOperation(value = "删除商品")
	@PostMapping(value = "/delete")
    @RequiresPermissions("antOrder.delete")
	public Object del(HttpServletRequest request) {
		AntOrder param = WebUtil.getParameter(request, AntOrder.class);
		return super.delete(param);
	}
}